Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(jans-cedarling): shorten conditional #10812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

SafinWasi
Copy link
Contributor

Prepare


Description

Target issue

closes #10810

Implementation Details


Test and Document the changes

N/A

Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with docs: to indicate documentation changes or if the below checklist is not selected.

  • I confirm that there is no impact on the docs due to the code changes in this PR.

@mo-auto mo-auto added area-documentation Documentation needs to change as part of issue or PR comp-docs Touching folder /docs comp-jans-cedarling Touching folder /jans-cedarling labels Feb 7, 2025
Copy link
Contributor

@olehbozhok olehbozhok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you don't need to remove attribute has because it can cause error in evaluating this rule

@@ -100,7 +100,7 @@ To test the plugin, you will need:
resource is gatewayDemo::HTTP_Request
)
when {
((principal has "access_token") && ((principal["access_token"]) has "scope")) && (((principal["access_token"])["scope"]).contains("profile"))
((principal["access_token"])["scope"]).contains("profile")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must check for presence of nested, optional attributes one layer at a time. For example, to check for the presence of principal.custom.project where both custom and project are optional, you must first check if principal has a custom attribute and then check that it principal.custom has a project attribute:

https://docs.cedarpolicy.com/policies/syntax-operators.html#operator-has

Copy link
Contributor

@olehbozhok olehbozhok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree to make the rule shorten, but approve if Michael agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-documentation Documentation needs to change as part of issue or PR comp-docs Touching folder /docs comp-jans-cedarling Touching folder /jans-cedarling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs(jans-cedarling): update krakend readme for scope based access
3 participants